﻿using System;

public class Mapper094 : MapperDefault
{
    public override void init(NES nes)
    {
        base.init(nes);
    }

    public override void loadROM(ROM rom)
    {
        int romBankCount = rom.RomBankCount;
        this.loadRomBank(0, 0x8000);
        this.loadRomBank(romBankCount - 1, 0xc000);
        this.loadCHRROM();
        base.nes.Cpu.requestIrq(2);
    }

    public override void write(int address, short value_Renamed)
    {
        if (address < 0x8000)
        {
            base.write(address, value_Renamed);
        }
        else if ((address & 0xfff0) == 0xff00)
        {
            int bank = (value_Renamed & 0x1c) >> 2;
            this.loadRomBank(bank, 0x8000);
        }
    }
}

